#
# This file is a part of the open-eBackup project.
# This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
# If a copy of the MPL was not distributed with this file, You can obtain one at
# http://mozilla.org/MPL/2.0/.
#
# Copyright (c) [2024] Huawei Technologies Co.,Ltd.
#
# THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
#

from oracle.common.device_manager.constants import SnapshotHealthStatus, SnapshotRunningStatus


class DeviceInfo:
    def __init__(
            self,
            ip: str,
            port: int,
            username: str,
            password: str,
            cert_enable: bool = False,
            cert_path: str = '',
            crl_path: str = '',
            retry_flag: bool = True):
        self.ip = ip
        self.port = port
        self.username = username
        self.password = password
        self.cert_enable = cert_enable
        self.cert_path = cert_path
        self.crl_path = crl_path
        self.retry_flag = retry_flag


class SessionInfo:
    def __init__(
            self,
            base_url: str = '',
            device_id: str = '',
            token: str = '',
            cookie: str = ''):
        self.base_url = base_url
        self.device_id = device_id
        self.token = token
        self.cookie = cookie


class LunInfo:
    def __init__(
            self,
            lun_id: str = '',
            name: str = '',
            lun_type: int = 11,
            parent_id: str = '',
            health_status: int = 1,
            running_status: int = 27,
            wwn: str = '',
            v_store_id: int = 0,
            capacity: int = 0
    ):
        self.lun_id = lun_id
        self.name = name
        self.lun_type = lun_type
        self.parent_id = parent_id
        self.health_status = health_status
        self.running_status = running_status
        self.wwn = wwn
        self.v_store_id = v_store_id
        self.capacity = capacity


class StorageTaskInfo:
    def __init__(
            self,
            task_id: str = '',
            task_status: str = ''
    ):
        self.task_id = task_id
        self.task_status = task_status


class HyperMetroPair:
    def __init__(
            self,
            pair_id: str = '',
            local_access_state: str = '',
            local_name: str = ''
    ):
        self.pair_id = pair_id
        self.local_access_state = local_access_state
        self.local_name = local_name


class ProtectGroupInfo:
    def __init__(
            self,
            protect_group_id: str = '',
            protect_group_name: str = '',
            snapshot_group_num: int = 0,
            v_store_id: int = 0,
            lun_group_name: str = '',
            lun_group_id: str = '',
            lun_num: int = 0):
        self.protect_group_id = protect_group_id
        self.protect_group_name = protect_group_name
        self.snapshot_group_num = snapshot_group_num
        self.v_store_id = v_store_id,
        self.lun_group_name = lun_group_name,
        self.lun_group_id = lun_group_id,
        self.lun_num = lun_num


class SnapshotConsistencyGroup:
    def __init__(
            self,
            group_id: str = '',
            name: str = '',
            parent_id: str = '',
            parent_name: str = '',
            restore_speed: int = 0,
            v_store_id: int = 0):
        self.group_id = group_id
        self.name = name
        self.parent_id = parent_id
        self.parent_name = parent_name
        self.restore_speed = restore_speed
        self.v_store_id = v_store_id


class SnapshotInfo:
    def __init__(
            self,
            snapshot_id: str = '',
            name: str = '',
            snapshot_type: str = '',
            parent_id: str = '',
            v_store_id: int = 0,
            wwn: str = '',
            parent_wwn: str = '',
            health_status: int = SnapshotHealthStatus.NORMAL,
            running_status: int = SnapshotRunningStatus.UNKNOWN,
            snap_cons_group_id: str = ''):
        self.snapshot_id = snapshot_id
        self.name = name
        self.snapshot_type = snapshot_type
        self.parent_id = parent_id
        self.v_store_id = v_store_id
        self.wwn = wwn
        self.parent_wwn = parent_wwn
        self.health_status = health_status
        self.running_status = running_status
        self.snap_cons_group_id = snap_cons_group_id


class DeviceSystemInfo:
    def __init__(
            self,
            product_mode_string: str = ''):
        self.product_mode_string = product_mode_string


class StoragePoolInfo:
    def __init__(
            self,
            storage_pool_id: str = '',
            name: str = '',
            storage_pool_capacity_usage_ratio: str = '',
            storage_pool_free_capacity: str = '',
            storage_pool_total_capacity: str = ''):
        self.storage_pool_id = storage_pool_id
        self.name = name
        self.storage_pool_capacity_usage_ratio = storage_pool_capacity_usage_ratio
        self.storage_pool_free_capacity = storage_pool_free_capacity
        self.storage_pool_total_capacity = storage_pool_total_capacity
